import React from 'react';
import classNames from 'classnames';
import {
  Row,
  Col,
  Panel,
  Button
} from 'react-bootstrap';

import { Link } from 'react-router';
import * as Util from '../common/Util';
import * as Apis from '../config/Apis';
import * as Shell from '../common/Shell';
import Notify from '../common/Notification';
import { message as MessageConfig, domain } from '../config/Common';

class MessageRecommend extends React.Component {

  constructor() {
    super();
  }

  static propTypes = {
       
  }

  renderFooterLink(){
    let { message } = this.props;
    let queryDate = null;
    if (message && message.dateint) {
      queryDate = message.dateint;
    }

    return (
        <Link to={`/Recommend`} query={{searchdate:queryDate, from:"message"}}>
          <small>查看详情</small>
        </Link>
    );
  }

  renderHeader(){
    let { message } = this.props;
    let messageDate = null;
    if (message && message.createtime ) {
       messageDate = Util.DateFormater(message.createtime, "yyyy-MM-dd");
    }
    return (
      <span>
        {messageDate} 盘前股讯
      </span>
    );
  }

  render(){

      let { message } = this.props;

      return (
          <Panel header={this.renderHeader()} className="recommend-container" footer={this.renderFooterLink()}>
             {
                message && message.data && message.data.length && message.data.map((item, i) =>  
                  {
                    return (
                      <h6 className="text-danger">
                        {item.stockname}（{item.stockcode}）
                      </h6>   
                    )
                  }
                )
             }
          </Panel>
      );
  }
}

export default MessageRecommend;